package test.spring.aop;

import my.spring.aop.advice.Advice;
import my.spring.aop.aspect.Advisor;
import my.spring.aop.aspect.DefaultPointcutAdvisor;
import my.spring.aop.pointcut.AnnotationMatchingPointcut;
import my.spring.aop.pointcut.Pointcut;
import my.spring.ioc.annotation.Bean;
import my.spring.ioc.annotation.Config;

/**
 * @author fengbo
 * @date 2018/7/3
 */
@Bean("factoryBean")
@Config
public class MyProxyFactoryBean {

    @Bean("advisor")
    public Advisor getAdvisor() {
        Advice advice = new MyMethodBeforeAdvice();
        Pointcut pointcut = new AnnotationMatchingPointcut(MyAop.class);
        return new DefaultPointcutAdvisor(advice, pointcut);
    }
}
